// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
use crate::Result;

/// Implements a [StorageControl](super::stub::StorageControl) decorator for logging and tracing.
#[derive(Clone, Debug)]
pub struct StorageControl<T>
where
    T: super::stub::StorageControl + std::fmt::Debug + Send + Sync,
{
    inner: T,
}

impl<T> StorageControl<T>
where
    T: super::stub::StorageControl + std::fmt::Debug + Send + Sync,
{
    pub fn new(inner: T) -> Self {
        Self { inner }
    }
}

impl<T> super::stub::StorageControl for StorageControl<T>
where
    T: super::stub::StorageControl + std::fmt::Debug + Send + Sync,
{
    #[tracing::instrument(ret)]
    async fn create_folder(
        &self,
        req: crate::model::CreateFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Folder>> {
        self.inner.create_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_folder(
        &self,
        req: crate::model::DeleteFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_folder(
        &self,
        req: crate::model::GetFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::Folder>> {
        self.inner.get_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_folders(
        &self,
        req: crate::model::ListFoldersRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListFoldersResponse>> {
        self.inner.list_folders(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn rename_folder(
        &self,
        req: crate::model::RenameFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.rename_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_storage_layout(
        &self,
        req: crate::model::GetStorageLayoutRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::StorageLayout>> {
        self.inner.get_storage_layout(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_managed_folder(
        &self,
        req: crate::model::CreateManagedFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ManagedFolder>> {
        self.inner.create_managed_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn delete_managed_folder(
        &self,
        req: crate::model::DeleteManagedFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<()>> {
        self.inner.delete_managed_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_managed_folder(
        &self,
        req: crate::model::GetManagedFolderRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ManagedFolder>> {
        self.inner.get_managed_folder(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_managed_folders(
        &self,
        req: crate::model::ListManagedFoldersRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListManagedFoldersResponse>> {
        self.inner.list_managed_folders(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn create_anywhere_cache(
        &self,
        req: crate::model::CreateAnywhereCacheRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.create_anywhere_cache(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn update_anywhere_cache(
        &self,
        req: crate::model::UpdateAnywhereCacheRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.update_anywhere_cache(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn disable_anywhere_cache(
        &self,
        req: crate::model::DisableAnywhereCacheRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::AnywhereCache>> {
        self.inner.disable_anywhere_cache(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn pause_anywhere_cache(
        &self,
        req: crate::model::PauseAnywhereCacheRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::AnywhereCache>> {
        self.inner.pause_anywhere_cache(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn resume_anywhere_cache(
        &self,
        req: crate::model::ResumeAnywhereCacheRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::AnywhereCache>> {
        self.inner.resume_anywhere_cache(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_anywhere_cache(
        &self,
        req: crate::model::GetAnywhereCacheRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::AnywhereCache>> {
        self.inner.get_anywhere_cache(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn list_anywhere_caches(
        &self,
        req: crate::model::ListAnywhereCachesRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::ListAnywhereCachesResponse>> {
        self.inner.list_anywhere_caches(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_project_intelligence_config(
        &self,
        req: crate::model::GetProjectIntelligenceConfigRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IntelligenceConfig>> {
        self.inner
            .get_project_intelligence_config(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn update_project_intelligence_config(
        &self,
        req: crate::model::UpdateProjectIntelligenceConfigRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IntelligenceConfig>> {
        self.inner
            .update_project_intelligence_config(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn get_folder_intelligence_config(
        &self,
        req: crate::model::GetFolderIntelligenceConfigRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IntelligenceConfig>> {
        self.inner
            .get_folder_intelligence_config(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn update_folder_intelligence_config(
        &self,
        req: crate::model::UpdateFolderIntelligenceConfigRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IntelligenceConfig>> {
        self.inner
            .update_folder_intelligence_config(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn get_organization_intelligence_config(
        &self,
        req: crate::model::GetOrganizationIntelligenceConfigRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IntelligenceConfig>> {
        self.inner
            .get_organization_intelligence_config(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn update_organization_intelligence_config(
        &self,
        req: crate::model::UpdateOrganizationIntelligenceConfigRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<crate::model::IntelligenceConfig>> {
        self.inner
            .update_organization_intelligence_config(req, options)
            .await
    }

    #[tracing::instrument(ret)]
    async fn get_iam_policy(
        &self,
        req: iam_v1::model::GetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.get_iam_policy(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn set_iam_policy(
        &self,
        req: iam_v1::model::SetIamPolicyRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::Policy>> {
        self.inner.set_iam_policy(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn test_iam_permissions(
        &self,
        req: iam_v1::model::TestIamPermissionsRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<iam_v1::model::TestIamPermissionsResponse>> {
        self.inner.test_iam_permissions(req, options).await
    }

    #[tracing::instrument(ret)]
    async fn get_operation(
        &self,
        req: longrunning::model::GetOperationRequest,
        options: gax::options::RequestOptions,
    ) -> Result<gax::response::Response<longrunning::model::Operation>> {
        self.inner.get_operation(req, options).await
    }

    fn get_polling_error_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_error_policy::PollingErrorPolicy> {
        self.inner.get_polling_error_policy(options)
    }

    fn get_polling_backoff_policy(
        &self,
        options: &gax::options::RequestOptions,
    ) -> std::sync::Arc<dyn gax::polling_backoff_policy::PollingBackoffPolicy> {
        self.inner.get_polling_backoff_policy(options)
    }
}
